import * as client from './client'
import urlConfig from './urlConfig'
///快捷支付
/**
 * 请求参数
 */
export class PayRst {
    /**
     * 支付请求参数
     */
    public merchantType: number;
    public clientType: number;
    public paymentType: number;
    public paymentMethod: number;
    public salesOrderCode: string;
    public remark: string;
    public returnUrl: string;
    public clientIP: string;
    public wapUrl: string;
}
/**
 * 返回数据
 */
export class PayRpn {
    public isSuccess: number;
    //状态码？
    public code: string;
    //描述
    public description: string;
    //返回数据
    public resData: rsponseData;
}

export class rsponseData {
    public linkUrl: string;
    public paymentCode: string;
    public tokenID: string;
    public jsApiJson: string;
    public aliApiJson: string;
    public aliHtml: string;
}

/**
 * 获取数据
 * @param rst 参数
 */
export async function exec(rst: PayRst, userInfo: any) {
    // console.log(rst)
    const data = await client.exec(urlConfig.pay, rst, userInfo);
    //return JSON.parse(data) as client.RSM<OrderRpn>;
    return JSON.parse(data) as PayRpn;
}
